﻿

using Inovout.Data.Domain;
using System.Collections.Generic;
using System.Linq;
using System;
using System.ComponentModel.DataAnnotations;

namespace KuaJing.Organization.Domain
{
    public partial class OrganizationUnit : IDepartment, IOrganizationStructural, ICompany
    {
        public OrganizationUnit(OrganizationUnit parent)
        {
            this.Parent = parent;
        }
        #region IDepartment
        IEnumerable<IDepartment> IDepartment.Children
        {
            get { return this.Children.OfType<IDepartment>(); }
        }

        IEnumerable<Employee> IDepartment.Employees
        {
            get
            {
                //return null;
                return this.Employees;
            }
        }

        IDepartment IDepartment.Parent
        {
            get
            {
                return this.Parent as IDepartment;
            }
        }
        #endregion


        IEnumerable<IDepartment> IOrganizationStructural.Children
        {
            get { return this.Children.OfType<IDepartment>(); }

        }

        public virtual IEnumerable<IDepartment> Departments
        {
            get
            {
                return this.Children.OfType<IDepartment>();
            }
        }

        IEnumerable<IDepartment> ICompany.Departments
        {
            get
            {
                return this.Children.OfType<IDepartment>();
            }
        }

        IEnumerable<Employee> ICompany.Employees
        {
            get
            {
               //  return this.Employees;
               return null;
            }
        }

        IEnumerable<Position> IDepartment.Positions
        {
            get
            {
                //return this.Positions;
                return null;
            }
        }
    }
}
